import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import './styles/index.css';
import axios from './util/axios'
import store from './store'
import '@/permission' // permission control

Vue.prototype.$axios = axios
import projectmenu from './views/project/projectmenu.vue'
Vue.component('project-menu',projectmenu)
/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online! ! !
 */
import { mockXHR } from '../mock'
process.env.VUE_APP_MOCK == 'true' && console.log('===== mock data ! =====')
process.env.VUE_APP_MOCK == 'true' && mockXHR()
// if (process.env.NODE_ENV !== 'production') {
//   console.log('===== mock data ! =====')
//   mockXHR()
// }
import echarts from "echarts";
import './assets/directives.js'

Vue.prototype.$echarts = echarts;
Vue.use(ElementUI);
Vue.config.productionTip = false
router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

// axios.get('/hello')
//   .then(e => {
//     let data = e.data
//     console.log('======', data)
//   })
//   .catch(err => {
//     console.log('======', err)
//   })